let db=require('../db/index')

exports.publishArticleAPI=(req,res)=>{
    console.log(req.query)
    var sql = `insert into article(id,user,title,content,class,date,articleFirstImg) 
    value('${req.query.id}','${req.query.username}','${req.query.title}','${req.query.content}','${req.query.class}','${req.query.date}','${req.query.articleFirstImg}')`
    // console.log('req.username'+req.username)
    // var sql = `update user set user = '${req.body.user}'
    db.query(sql,[
        req.query.user,
        req.query.title,
        req.query.id,
        req.query.content,
        req.query.date,
        req.query.class,
        req.query.articleFirstImg,
     
        
        
    ],(err,data)=>{
        if(err){
            return res.send('错误:'+err.message+'找不到该用户')
        }
        res.send(data)
    })
}